import demo1.javaTest;

class C{
    public String name;
    //父类中带一个参数的构造函数
    public C(String name) {
        this.name = name;
        System.out.println("父类中带一个参数的构造函数C");
    }
    public  void test(){
        System.out.println("父类中被final修饰的方法");
    }
}

class D extends C {
    public int age;
    //子类中带两参数的构造函数
    public D(String name, int age) {
        //在调用子类构造函数前先调用父类的构造函数
        super(name);
        this.age = age;
        System.out.println("子类中带两个参数的构造函数D");
    }

    public D(String name) {
        super(name);
    }

    @Override
    public void test() {
        super.test();
    }
}
class testDemo1 extends javaTest{

    public void test(){
        fun();
    }


}

public class demo4 {
    public static void main(String[] args) {

        //实例化子类对象d
        //D d=new D("父类成员变量",44);
        testDemo1 test=new testDemo1();
        test.test();

    }
}
